#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: spllice01_category_type.py 
@version:
@time: 2022/02/16 
"""
from TapClientCaseData.ColumnGenerateData.dynamic.base.base03_mongodb import *

__all__ = [
    'dic_add', 'PK',
    'DOUBLE', 'STRING', 'OBJECT', 'ARRAY', 'BINARY_DATA',
    'UNDEFINED', 'OBJECTID', 'BOOLEAN', 'DATE', 'NULL',
    'REGEX', 'JAVASCRIPT', 'INT32', 'INT64', 'TIMESTAMP',
    'DECIMAL128', 'MINKEY', 'MAXKEY',

    'MONGODB_NUMBER_ALL_TYPE',
    'MONGODB_STRING_ALL_TYPE',
    'MONGODB_DATE_ALL_TYPE',
    'MONGODB_OTHER_ALL_TYPE',
    'MONGODB_ALL_TYPE',
    'MONGODB_ALL_TYPE_INSERT',
    'MONGODB_ALL_TYPE_UPDATE'
]


def dic_add(*args):
    tmp = {}
    for i in args:
        tmp.update(i)
    return tmp


# NUMBER
MONGODB_NUMBER_ALL_TYPE = dic_add(
    PK,
    DOUBLE,
    INT32,
    INT64,
    DECIMAL128,
    MINKEY,
    MAXKEY
)

# STING
MONGODB_STRING_ALL_TYPE = dic_add(
    PK,
    STRING,
    UNDEFINED,
    NULL
)

# DATE
MONGODB_DATE_ALL_TYPE = dic_add(
    PK,
    TIMESTAMP,
    DATE
)

# OTHER
MONGODB_OTHER_ALL_TYPE = dic_add(
    PK,
    OBJECT,
    ARRAY,
    BINARY_DATA,
    OBJECTID,
    BOOLEAN,
    REGEX,
    JAVASCRIPT,
)

MONGODB_ALL_TYPE = [dic_add(
    MONGODB_NUMBER_ALL_TYPE,
    MONGODB_STRING_ALL_TYPE,
    MONGODB_DATE_ALL_TYPE,
    MONGODB_OTHER_ALL_TYPE
)]
MONGODB_ALL_TYPE_INSERT = [dic_add(
    {'pk': 2},
    MONGODB_NUMBER_ALL_TYPE,
    MONGODB_STRING_ALL_TYPE,
    MONGODB_DATE_ALL_TYPE,
    MONGODB_OTHER_ALL_TYPE
)]
MONGODB_ALL_TYPE_UPDATE = [dic_add(
    {'pk': 2},
    {'STRING': 'update'},
    {'OBJECT': {"tapdata": "update"}},
    {'ARRAY': ["update"]},
    {'OBJECTID': ObjectId()},
    {'BOOLEAN': False},
    {'DATE': datetime.utcnow()},
    {'JAVASCRIPT': Code('function(){ tapdata = 1}')},
    {'INT32': 200},
    {'INT64': Int64(2000)},
    {'TIMESTAMP': Timestamp(2, 2)},
    {'DECIMAL128': Decimal128('100')}
)]
